<template>
  <div>
    <h1>EventTest组件</h1>
    <!-- 原生dom事件用在html标签身上和组件身上的区别 -->
    <button @click="test">test</button>
    <Event1 @click.native="test2">test2</Event1>

    <!-- 自定义事件在HTML标签上和组件标签上的区别 -->
    <button @xxx="test3">test3</button>
    <Event2 @click="test4" @xxx="test4">test4</Event2>
  </div>
</template>

<script type="text/ecmascript-6">
  import Event1 from './Event1.vue'
  import Event2 from './Event2.vue'

  export default {
    name: 'EventTest',

    components: {
      Event1,
      Event2,
    },

    methods: {
     test(event){
       console.log(event.target.innerHTML);
     },
     test2(event){
       console.log(event.target.innerHTML);
     },
     test3(event){
       console.log(event.target.innerHTML);
     },
     test4(event){
       console.log(event);
     }
    }
  }
</script>
